from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.sql import func
from app.core.database import Base

class VisitLog(Base):
    __tablename__ = "visit_logs"
    
    id = Column(Integer, primary_key=True, index=True)
    user_id = Column(Integer, ForeignKey("users.id"), nullable=True, index=True)
    wechat_openid = Column(String(100), nullable=True, index=True)
    visit_time = Column(DateTime(timezone=True), server_default=func.now(), index=True)
    page = Column(String(100), nullable=True)
    action = Column(String(50), nullable=True)
    ip_address = Column(String(50), nullable=True)

